package cn.zyq.ykb.system.enums.core;

import cn.zyq.ykb.system.exception.BusinessException;

public enum PayOrderBusinessTypeEnum {
    RWSY("任务收益", 1),
    TX("提现", 2),
    GMDJ("购买道具支出", 3),
    RWFB("任务发布支出", 4),
    XGJG("修改价格支出", 5),
    XGSL("修改数量支出", 6),
    GMKC("购买课程支出", 6),
    ;
    private final String key;
    private final Integer value;

    PayOrderBusinessTypeEnum(String key, Integer value) {
        this.key = key;
        this.value = value;
    }


    public static String getKeyByValue(Integer value) {
        for (PayOrderBusinessTypeEnum item : PayOrderBusinessTypeEnum.values()) {
            if (item.value.equals(value)) return item.key;
        }
        throw new BusinessException(ResponseCodeEnum.ERROR, "无效的value值");
    }

    public static String getValueByKey(String key) {
        for (PayOrderBusinessTypeEnum item : PayOrderBusinessTypeEnum.values()) {
            if (item.key.equals(key)) return item.getValue().toString();
        }
        throw new BusinessException(ResponseCodeEnum.ERROR, "无效的key值");
    }


    public Integer getValue() {
        return value;
    }

}
